/**
 * 
 * @param {*} ele  元素节点
 * @param {*} styleObj  变量对象
 * @param {*} duration 持续时长
 */
function animate(ele, styleObj, duration,callback) {
    console.log(222,ele, styleObj, duration);
    var timer = 20;
    var stepTotal = duration / timer;
    var regionCss = {};
    count = 0;
    var clock;
    for (var key in styleObj) {
      regionCss[key] = parseInt(window.getComputedStyle(ele, null)[key]);
      // console.log(regionCss[key])
    }

    clock = setInterval(function () {
      count++;
      for (var key in styleObj) {
        moveStep =(parseInt(styleObj[key]) - regionCss[key])/ stepTotal;
        

        //开始移动

        ele.style[key] = count * moveStep+ regionCss[key] + 'px'; 
        // console.log(ele.style[key])
      }
      if (count >= stepTotal) {
        clearInterval(clock);
        for (var key in styleObj) {
          ele.style[key] = styleObj[key] + 'px';
        }
        callback && callback()
      }
    }, timer);
  }